﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
namespace GameVer1
{
    public class LoadAllReSource
    {
        #region Attribute
        private int _nTextureResource;
        private Texture2D[] _ArrayTexture;
        #endregion

        #region Properties

        public int NTextureResource
        {
            get { return _nTextureResource; }
            set { _nTextureResource = value; }
        }

        public Texture2D[] ArrayTexture
        {
            get { return _ArrayTexture; }
            set { _ArrayTexture = value; }
        }
        #endregion

        #region Method

        public Texture2D[] LoadTexture( Game1 g,string pathResource )
        {
            Texture2D[] AllBitmap;
            string[] fileName;
            string nameFolder;
            nameFolder = pathResource;
            fileName = System.IO.Directory.GetFiles(nameFolder);
            _nTextureResource = fileName.Length;

            AllBitmap = new Texture2D[_nTextureResource];
            for (int i = 0; i < _nTextureResource; i++)
            {
                fileName[i] = fileName[i].Replace(".xnb", "");
                fileName[i] = fileName[i].Replace("\\", "/");
                fileName[i] = fileName[i].Replace("Content/", "");
                AllBitmap[i] = g.Content.Load<Texture2D>(fileName[i]);
            }

            // Load content cac texture


            return AllBitmap;
        }
        #endregion 

       



    }
}
